$OpenBSD: patch-src_plotone_c,v 1.1 2002/08/27 11:48:56 naddy Exp $
--- src/plotone.c.orig	Wed Feb 27 21:29:56 2002
+++ src/plotone.c	Mon Aug 26 11:11:08 2002
@@ -113,7 +113,7 @@ void do_hardcopy(void)
     char fname[GR_MAXPATHLEN];
     view v;
     double vx, vy;
-    int truncated_out;
+    int truncated_out, fd;
     
     if (get_ptofile()) {
         if (print_file[0] == '\0') {
@@ -127,12 +127,19 @@ void do_hardcopy(void)
             errmsg("No print command defined, output aborted");
             return;
         }
-        tmpnam(fname);
+
         /* VMS doesn't like extensionless files */
-        strcat(fname, ".prn");
+        strlcpy(fname, P_tmpdir, sizeof fname);
+	strlcat(fname, "grace-XXXXXXXXXX.prn", sizeof fname);
+	fd = mkstemps(fname, 4);
+	if (fd == -1) {
+	    errmsg("Could not create tmp file.");
+	    return;
+	} else
+	    close(fd);
     }
     
-    prstream = grace_openw(fname);
+    prstream = filter_write(fname);
     
     if (prstream == NULL) {
         return;
